package com.lemonPiggy.message.service.impl;

import java.util.List;

import com.lemonPiggy.message.domain.MessageBase;
import com.lemonPiggy.message.mapper.MessageBaseMapper;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.IdUtils;
import com.lemonPiggy.message.service.IMessageBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 消息基础Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-08-17
 */
@Service
public class MessageBaseServiceImpl implements IMessageBaseService
{
    @Autowired
    private MessageBaseMapper messageBaseMapper;

    /**
     * 查询消息基础
     * 
     * @param id 消息基础ID
     * @return 消息基础
     */
    @Override
    public MessageBase selectMessageBaseById(String id)
    {
        return messageBaseMapper.selectMessageBaseById(id);
    }

    /**
     * 查询消息基础列表
     * 
     * @param messageBase 消息基础
     * @return 消息基础
     */
    @Override
    public List<MessageBase> selectMessageBaseList(MessageBase messageBase)
    {
        return messageBaseMapper.selectMessageBaseList(messageBase);
    }

    /**
     * 新增消息基础
     * 
     * @param messageBase 消息基础
     * @return 结果
     */
    @Override
    public int insertMessageBase(MessageBase messageBase)
    {
        messageBase.setId(IdUtils.simpleUUID());
        messageBase.setCreateTime(DateUtils.getNowDate());
        messageBase.setUpdateTime(DateUtils.getNowDate());
        messageBase.setCreateBy(messageBase.getUpdateBy());
        return messageBaseMapper.insertMessageBase(messageBase);
    }

    /**
     * 修改消息基础
     * 
     * @param messageBase 消息基础
     * @return 结果
     */
    @Override
    public int updateMessageBase(MessageBase messageBase)
    {
        messageBase.setUpdateTime(DateUtils.getNowDate());
        return messageBaseMapper.updateMessageBase(messageBase);
    }

    /**
     * 批量删除消息基础
     * 
     * @param ids 需要删除的消息基础ID
     * @return 结果
     */
    @Override
    public int deleteMessageBaseByIds(String[] ids)
    {
        return messageBaseMapper.deleteMessageBaseByIds(ids);
    }

    /**
     * 删除消息基础信息
     * 
     * @param id 消息基础ID
     * @return 结果
     */
    @Override
    public int deleteMessageBaseById(String id)
    {
        return messageBaseMapper.deleteMessageBaseById(id);
    }

    @Override
    public List<MessageBase> selectMessageBaseListCanSend(MessageBase messageBase) {
        return messageBaseMapper.selectMessageBaseListCanSend(messageBase);
    }
}
